package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.NursingProjectDto;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.zzyl.common.utils.PageUtils.startPage;

@RestController
@RequestMapping("/member/orders/project")
@Api(tags =  "护理项目相关接口")
public class MemberOrdersProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("查询护理项目订单列表")
    public TableDataInfo<List<NursingProjectDto>> page(@ApiParam(value = "护理项目查询条件") NursingProject nursingProject){
        startPage();
        List<NursingProjectDto> list = nursingProjectService.selectNursingProjectDtoList(nursingProject);
        return getDataTable(list);
    }

    @GetMapping("{id}")
    @ApiOperation("获取护理项目订单详细信息")
    public R<NursingProjectDto> getInfo(@ApiParam(value = "护理项目ID", required = true)
                                   @PathVariable("id") Long id){
        NursingProjectDto nursingProjectDto = nursingProjectService.selectNursingProjectDotById(id);
        return R.ok(nursingProjectDto);
    }
}

